package cn.iocoder.yudao.module.asasc.controller.admin.profitreport.vo;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "管理后台 - 投入产出报告分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ProfitReportPageReqVO extends PageParam {

    @Schema(description = "组织 ID", example = "48")
    private Long orgId;

    @Schema(description = "应用Ids", example = "4324")
    private Long[] adamIds;

    @Schema(description = "日期")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDate[] repDate;

    @Schema(description = "国家代码集合")
    private String[] countries;

    @Schema(description = "维度：日期、国家、应用")
    private String[] dimension;

    private boolean containsRepDate;
    private boolean containsCountry;
    private boolean containsAdamId;

    public void setDimension(String[] dimension) {
        this.dimension = dimension;
        List<String> dimensionList = Arrays.asList(dimension);
        this.containsRepDate = dimensionList.contains("rep_date");
        this.containsCountry = dimensionList.contains("country");
        this.containsAdamId = dimensionList.contains("adam_id");
    }
}